package com.ss6621.spring1.Controller;

import com.ss6621.spring1.Service.UserService;
import com.ss6621.spring1.pojo.User;
import com.ss6621.spring1.utils.Result;
import jakarta.annotation.Resource;
import lombok.NoArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static org.springframework.security.authorization.AuthorityReactiveAuthorizationManager.hasRole;

@RestController

@RequestMapping("/admin")
public class UserController {
    @Resource
    private  UserService userService;
    //返回所有用户
    @GetMapping("/get/allUser")
    public Result<List<User>>  getUser(){

        List<User>userAll = userService.findAll();
        return Result.success(userAll);
    }
}
